<template>
	<gui-page :customHeader="true" :headerClass="['gui-bg-green']" :full-page="true" :isHeaderSized="true">
		<template v-slot:gHeader>
			<view style="height: 44px" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
				<gui-header-leading :home="false" :backButtonClass="['gui-color-white']"></gui-header-leading>
				<text class="gui-bold gui-flex1 gui-text-center gui-ellipsis gui-color-white" style="margin-bottom: 5rpx; font-size: 16px">种子详情</text>
				<view style="width: 70rpx">
					<gui-datetime-between @confirm="confirmCalen" :startValue="dataRec.startValue" :endValue="dataRec.endValue" :isTime="false">
						<text class="gui-block gui-icons gui-color-white" style="font-size: 38rpx">&#xe6d1;</text>
					</gui-datetime-between>
				</view>
			</view>
		</template>
		<template v-slot:gBody>
			<view class="gui-padding">
				<view class="gui-bg-white gui-border-radius gui-padding" style="margin-bottom: 30rpx" v-for="item of dataRec.infoList" :key="item.id">
					<view class="gui-flex gui-space-between">
						<view class="gui-color-gray">扣除种子</view>
						<view class="gui-color-red1">-{{ item.num }}</view>
					</view>
					<view class="gui-margin-top gui-flex">
						<view class="gui-text" style="flex-shrink: 0">出库用途：</view>
						<view class="gui-text gui-color-grey1">{{ item.remark }}</view>
					</view>
					<view class="gui-text gui-color-grey4 gui-text-small" style="margin-top: 20rpx">{{ item.createtime }}</view>
				</view>
			</view>
		</template>
	</gui-page>
</template>
<script setup>
import { Local } from '@utils/storage.js';
import graceJS from '@/Grace6/js/grace.js';
import imgArr from '@assets/js/export.js';
import { inventory_logApi } from '@api/repertory.js';
import { reactive, ref, toRefs, onMounted, onActivated } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';

let imgArrRec = reactive(imgArr);
let dataRec = reactive({
	id: '',
	startValue: '',
	endValue: '',
	infoList: []
});
let confirmCalen = (res) => {
	console.log(res)
	dataRec.startValue = res[0][0] + '-' + res[0][1] + '-' + res[0][2];
	dataRec.endValue = res[1][0] + '-' + res[1][1] + '-' + res[1][2];
	getList();
};

let getList = async () => {
	let req = {
		id: dataRec.id,
		s_time: dataRec.startValue,
		e_time: dataRec.endValue
	};
	let res = await inventory_logApi(req);
	dataRec.infoList = res.data.data;
};
onLoad((query) => {
	dataRec.id = query.id;
	getList();
});
</script>
<style lang="scss" scoped>
page {
	background-color: #fafafa;
}
</style>
